import { Component } from '@angular/core';
import { Location } from '@angular/common';
// 引入Parse第三方库
import * as Parse from "parse"
(Parse as any).serverURL = "http://metapunk.cn:9999/parse"
Parse.initialize("dev")

@Component({
  selector: 'app-page-address',
  templateUrl: './page-address.component.html',
  styleUrls: ['./page-address.component.scss']
})
export class PageAddressComponent {
  constructor(
    private location :Location
  ){}
  goBack(){
    this.location.back();
  }
  addressName:any=[
   
  ]
  async ngOnInit(): Promise<void> {
    let list = await this.getAddress()
    console.log(list)
    // setTimeout(() => {
      this.addressName = this.addressName.concat(list)
      console.log( this.addressName+"456")
      
    // }, 1000);

  }
    async getAddress(){
    let result = await fetch("http://metapunk.cn:9999/parse/classes/address?", {
      "headers": {
        "accept": "*/*",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "if-none-match": "W/\"298-XWY293dEq5IoVMzAkX7CsaWu7EQ\"",
        "x-parse-application-id": "dev"
      },
      "referrer": "http://localhost:4040/",
      "referrerPolicy": "strict-origin-when-cross-origin",
      "body": null,
      "method": "GET",
      "mode": "cors",
      "credentials": "omit"
    });
    let data = await result.json();
    console.log(data+"123")
    let list = data?.results
    return list
  }
}

